from django.conf.urls import url
from django.contrib.auth.decorators import login_required

from . import views
urlpatterns = [
    url(r'^register/$', views.RgisterView.as_view(), name='register'),
    url(r'^usernames/(?P<username>\w{5,20})/count/$', views.CheckUserNameView.as_view(), name='username'),
    url(r'^mobiles/(?P<mobile>1[345789]\d{9})/count/$', views.CheckMobileView.as_view(), name='moblie'),
    url(r'^login/$', views.LoginView.as_view(), name='login'),
    url(r'^logout/$', views.LogoutView.as_view(), name='logout'),
    # url(r'^info/', views.UserCenterView.as_view(), name='info'),
    url(r'^info/$', views.UserCenterView.as_view(), name='info'),
    url(r'^emails/$', views.EmailSendView.as_view(), name='emails'),
    url(r'^emails/verification/$', views.EmailActiveView.as_view(), name='email_active'),
    url(r'^addresses/$', views.AddressView.as_view(), name='addresses'),
    url(r'^addresses/create/$', views.AddressCreateView.as_view(), name='addresses_create'),
    url(r'^addresses/(?P<address_id>\d+)/$', views.AddressUpdateView.as_view(), name='address_id'),
    url(r'^addresses/(?P<address_id>\d+)/default/$', views.AddressDefaultView.as_view(), name='default_id'),
    url(r'^addresses/(?P<address_id>\d+)/title/$', views.AddressTitleView.as_view(), name='addresses_title'),
    url(r'^password/$', views.PasswordChangeView.as_view(), name='password'),
    url(r'^browse_histories/$',views.UserBrowserHistoryView.as_view()),
    url(r'^find_password/$',views.FindPwdView.as_view()),
    url(r'^accounts/(?P<username>\w+)/sms/token/$',views.AccountsSmsView.as_view()),
    url(r'^accounts/(?P<username>\w+)/password/token/$',views.AccountsPwdView.as_view()),
    url(r'^sms_codes/$',views.SMScodeCheckView.as_view()),
    url(r'^users/(?P<user_id>\d+)/password/$',views.PasswordReset.as_view()),
]
